Xbasic

Array itemtype Method

Syntax

dim type as C = <array>.itemtype()

Returns

typeCharacter

The type returned by the array.

Description

Gets the data type of the elements in an array.

Discussion

The method returns the type of the elements in an array.

Example

dim arr1[0] as p
? arr1.itemtype()
= "P"

dim arr2[0] as c
? arr2.itemtype()
= "C"

dim arr3[0] as d
? arr3.itemtype()
= "D"

If the array is declared as type A (for "any type"), array elements are stored as pointer variables with a value property that is used to get the value of the array

dim arr2[0] as a
arr2[] = "Sandwich"
? arr2.itemtype()
= "P"

? arr2[1]
= VALUE = "Sandwich"